package com.study.db;

import com.study.bean.FileModel;
import com.study.bean.UserModel;
import com.study.greendao.FileModelDao;
import com.study.greendao.UserModelDao;

/**
 * 存放DaoUtils
 */
public class DaoUtilsStore {
    private volatile static DaoUtilsStore instance = new DaoUtilsStore();
    private CommonDaoUtils<FileModel> fileDaoUtils;
    private CommonDaoUtils<UserModel> userDaoUtils;

    public static DaoUtilsStore getInstance() {
        return instance;
    }

    private DaoUtilsStore() {
        DaoManager manager = DaoManager.getInstance();
        FileModelDao fileModelDao = manager.getDaoSession().getFileModelDao();

        fileDaoUtils = new CommonDaoUtils(FileModel.class, fileModelDao);
        UserModelDao userModelDao = manager.getDaoSession().getUserModelDao();
        userDaoUtils = new CommonDaoUtils(UserModel.class, userModelDao);
    }

    public CommonDaoUtils<FileModel> getFileDaoUtils() {
        return fileDaoUtils;
    }

    public CommonDaoUtils<UserModel> getUserDaoUtils() {
        return userDaoUtils;
    }
}